package com.jar.springbootsecuritydemo.controller;


import com.jar.springbootsecuritydemo.mapper.SysUserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class UserController {
    @Autowired
    private SysUserMapper sysUserMapper;

    @PreAuthorize("@ss.hasPermi('system:user:list')")
    @RequestMapping("/hello")
    public String hello() {
        return "hello ! springSecurity";
    }


    @PreAuthorize("@ss.hasPermi('system:role:list')")
    @RequestMapping("/test")
    public String test() {
        return "test";
    }

    @PreAuthorize("@ss.hasPermi('system:user:list')")
    @RequestMapping("/getUser")
    public Object listUsers() {
        return sysUserMapper.selectList(null);
    }



    public static void main(String[] args) {

    }

}
